;;;Multiple block attribute edits
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe Street
;;;		Southern Pines, NC 28387
;;;
;;;	http://paracadd.com
;;;	All rights reserved.
;;;
(defun c:mddatte ( / blkss blkcnt ndxcnt autopan)
  (initget 1 "ON OFf")
  (setq autopan "ON");(getkword "\nAuto Panning <ON/OFf>: "))
  (setq blkss (ssget '((-4 . "<AND")(0 . "INSERT")(66 . 1)(-4 . "AND>"))))
  (setq dimsc (getvar"dimscale"))
  (if (eq dimsc 0) (setq dimsc 1))
  (if blkss
    (progn
      (if (eq autopan "ON")
        (setq prev_view "PRE-MDDATTE")
      )
      (setq view_exists (tblsearch "VIEW" prev_view))
      (if view_exists
        (command ".view" "s" prev_view "y")
        (command ".view" "s" prev_view)
      )
      (setq blkcnt (sslength blkss)
            ndxcnt 0)
      (while (< ndxcnt blkcnt)
        (setq edata (entget (ssname blkss ndxcnt))
              ins_x (cadr (assoc 10 edata))
	    ins_y (caddr (assoc 10 edata))
	    ins_z (cadddr (assoc 10 edata))
	    win_llx (+ ins_x(* dimsc -1.6))
	    win_lly (+ ins_y(* dimsc -1.6))
	    win_urx (+ ins_x(* dimsc 12))
	    win_ury (+ ins_y(* dimsc 8))
        )
        (if (eq autopan "ON")
          (command ".zoom" "w"
                   (strcat (rtos win_llx 2 4) "," (rtos win_lly 2 4))
                   (strcat (rtos win_urx 2 4) "," (rtos win_ury 2 4))
          )
        )
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 0.25)(* dimsc 0.4))-1 1)
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 0.75)(* dimsc 0.4))-1 1)
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 1.25)(* dimsc 0.4))-1 1)
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 1.75)(* dimsc 0.4))-1 1)
        (command ".ddatte" (ssname blkss ndxcnt))
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 0.25)(* dimsc 0.4))-1 1)
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 0.75)(* dimsc 0.4))-1 1)
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 1.25)(* dimsc 0.4))-1 1)
        (grdraw (cdr(assoc 10 edata))(polar (cdr(assoc 10 edata)) (* pi 1.75)(* dimsc 0.4))-1 1)
        (setq ndxcnt (1+ ndxcnt))
      )
      (if (eq autopan "ON")
        (command ".view" "r" prev_view)
      )
    )
  )
)